package com.pacy.pacybaseproject.viewmodels;

import android.app.Application;

import androidx.annotation.NonNull;

import com.pacy.pacybaseproject.adapters.ReceiveAdapter;
import com.pacy.pacybaseproject.utils.Constants;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent;
import me.goldze.mvvmhabit.utils.DateUtil;

/**
 * @author PACY
 * @date 2024/1/15
 * description:
 */
public class AllReceiveViewModel extends BaseViewModel {
    public ReceiveAdapter mAdapter;
    //发生时间
    public SingleLiveEvent<String> occurTime=new SingleLiveEvent<>();
    public AllReceiveViewModel(@NonNull Application application) {
        super(application);
    }

    @Override
    protected void init() {
        super.init();
        occurTime.setValue(DateUtil.getNowDate(DateUtil.DatePattern.ONLY_MONTH));
        initAdapter();
    }

    public void initAdapter(){
        mAdapter=new ReceiveAdapter();
        mAdapter.setNewInstance(Constants.getTestData(10));
//        showEmpty();
        showContent();
    }


    public BindingCommand back=new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            finish();
        }
    });
}
